import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mymoduleb/MyView1.dart';
import 'package:mymoduleb/MyView2.dart';
import 'package:mymoduleb/MyView3.dart';
import 'package:mymoduleb/MyView4.dart';

class MyListViewPage extends StatefulWidget{
  @override
  State<MyListViewPage> createState() {
    return MyListViewPageState();
  }
}
class MyListViewPageState extends State<MyListViewPage>{

  int _currentIndex = 0;

  final List<Widget> _list = [
    MyView1(),MyView2(),MyView3(),MyView4()
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        theme: ThemeData(
          //设置子项选中颜色
          primaryColor: const Color(0xFF4C83F1),
          //设置子项选择时高亮背景
          highlightColor: const Color.fromRGBO(0, 0, 0, 0),
          //设置整体底部导航水波纹背景
          splashColor: const Color.fromRGBO(0, 0, 0, 0)
        ),
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          body: _list[_currentIndex],
          floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
          floatingActionButton: FloatingActionButton(
            onPressed: () {  },
            //按钮形状 ShapeBorder子类
            shape: const CircleBorder(
              side: BorderSide(
                color: Colors.grey,
                width: 3.0
              )
            ),
            //显示迷你悬浮按钮
            mini: false,
            //长按提示信息
            tooltip: '提示文字',
            //悬浮按钮背景颜色
            backgroundColor: const Color(0xFFFFFFFF),
            //backgroundColor: const Color(0xFF5982EA),
            //悬浮按钮文字/图标颜色
            foregroundColor: const Color(0xFF5982EA),
            //获得焦点颜色，配合autofocus:true使用
            //移动端无效
            //focusColor: Colors.orange,
            //悬浮颜色
            // hoverColor: Colors.yellow,
            //水波纹颜色（点击按钮触发）
            splashColor: Colors.deepPurple,
            //悬浮按钮阴影,默认6
            elevation: 0.0,
            //触摸按钮阴影大小，默认12
            highlightElevation: 0.0,
            // autofocus: true,
            //按钮中间显示的内容，通常都是图标
            child: const Icon(Icons.add),
          ),
          bottomNavigationBar: BottomNavigationBar(
            type: BottomNavigationBarType.fixed,
            selectedItemColor: const Color(0xFF4C83F1),
            selectedFontSize: 0.0,
            unselectedFontSize: 0.0,
            currentIndex: _currentIndex,
            items: const [
              BottomNavigationBarItem(
                icon: Icon(Icons.bookmark),
                label: ''
              ),BottomNavigationBarItem(
                  icon: Icon(Icons.person_add),
                  label: ''
              ),BottomNavigationBarItem(
                  icon: Icon(Icons.plus_one),
                  label: ''
              ),BottomNavigationBarItem(
                  icon: Icon(Icons.add_chart),
                  label: ''
              ),
            ],
            onTap: (index){
              setState(() {
                _currentIndex = index;
              });
            },
          ),
        )
    );
  }

}
